<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改商品')" />
    <th:block th:include="include :: select2-css" />
    <th:block th:include="include :: bootstrap-select-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-dict-edit" th:object="${tbGoodsDict}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label">商品名称：</label>
                <div class="col-sm-8">
                    <input name="goodsName" th:field="*{goodsName}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">生产厂家：</label>
                <div class="col-sm-8">
                    <select name="manufacturer" class="form-control m-b" th:with="type=${@dict.getType('goods_manufacturer')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{manufacturer}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">商品类型：</label>
                <div class="col-sm-8">
                    <select name="goodsType" class="form-control m-b" th:with="type=${@dict.getType('goods_type')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{goodsType}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">商品价格：</label>
                <div class="col-sm-8">
                    <input name="goodsPrice" th:field="*{goodsPrice}" class="form-control" min="1" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">品牌：</label>
                <div class="col-sm-8">
                    <select name="brand" class="form-control m-b" th:with="type=${@dict.getType('goods_brand')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{brand}"></option>
                    </select>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: select2-js" />
    <th:block th:include="include :: bootstrap-select-js" />
    <script th:inline="javascript">
        var prefix = ctx + "business/dict";
        $("#form-dict-edit").validate({
            rules:{
                dictSort:{
                    goodsPrice:true
                },
            },
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-dict-edit').serialize());
            }
        }
    </script>
</body>
</html>